<%--
  Created by IntelliJ IDEA.
  User: 瑱彬
  Date: 2015/5/27
  Time: 14:59
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<% String context = request.getContextPath(); %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>博客首页</title>
    <link rel="stylesheet" type="text/css" href="<%=context%>/thirdparts/bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" type="text/css" href="<%=context%>/thirdparts/bootstrap/css/bootstrap-theme.min.css">
    <link rel="stylesheet" type="text/css" href="<%=context%>/css/common.css"/>
    <link rel="stylesheet" type="text/css" href="<%=context%>/css/right.css"/>
    <link rel="stylesheet" type="text/css" href="<%=context%>/css/main.css"/>
    <script type="text/javascript" src="<%=context%>/js/jquery.min.js"></script>
    <script type="text/javascript" src="<%=context%>/thirdparts/bootstrap/js/bootstrap.min.js"></script>

</head>

<body>
<c:import url="top.jsp">
    <c:param name="pageName" value="index"/>
</c:import>
<div class="center">
    <div class="centerContainer row">
        <div class="leftContainer col-md-9 col-sm-12">
            <ul class="articalList">
                <c:if test="${list.size() == 0}">
                    <img src="<%=context%>/images/notfound.png" />
                </c:if>

                <c:forEach items="${list}" var="item">
                    <li>
                        <div class="usericon articalicon">
                            <c:choose>
                                <c:when test='${item.avatar != "" && item.avatar != null}'>
                                    <img src="${item.avatar}" alt="">
                                </c:when>
                                <c:otherwise>
                                    <img src="images/avatar.jpg" alt="">
                                </c:otherwise>
                            </c:choose>
                        </div>
                        <div class="articalItem">
                            <div class="artcalSharp"></div>
                            <div class="acticalPopBox">
                                <div class="author"><a href="<%=context%>/userlist?u=${item.userid}">${item.author}</a></div>
                                <a href="<%=context%>/content?b=${item.id}" class="titleA"><h1 class="articalTitle">${item.title}</h1></a>

                                <div class="summaryBox">
                                    <c:if test="${item.thumb}">
                                        <div class="thumb">
                                            <img src="${item.thumb}" alt="">
                                        </div>
                                    </c:if>
                                    <div class="summaryText">${item.bcontent}</div>
                                </div>
                                <a href="<%=context%>/content?b=${item.id}" class="readMore">阅读更多内容-></a><br/>

                                <div class="popBottom row">
                                    <div class="tags col-md-6">
                                        <span class="glyphicon glyphicon-tags" aria-hidden="true"></span>
                                        <c:forEach items="${item.tags}" var="tag">
                                            <span class="tags" blog="${item.id}">${tag}</span>
                                        </c:forEach>
                                    </div>
                                    <div class="hits col-md-6">
                                        <div class="hitsFloatRight">
                                            <span id="hitCount">读度(${item.hits})</span>
                                            <span id="commentNum">评论(${item.commentCount})</span>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </li>
                </c:forEach>
            </ul>
            <c:if test="${list.size() != 0}">
                <div class="pagination">${pageNavigation}</div>
            </c:if>
        </div>
        <div class="rightContainer col-md-3 col-sm-0">
            <div class="rightItem" id="categoryBox">
                <div class="title">文章分类</div>
                <ul class="rlist">
                    <c:forEach items="${categorys}" var="cat">
                    <li><span class="listTitle"><a href="<%=context%>/category?c=${cat.id}">${cat.name}</a></span><span class="listRight listNum">${cat.blogsum}</span></li>
                    </c:forEach>
                </ul>
            </div>
            <div class="rightItem" id="userRecommendBox">
                <div class="title">推荐达人</div>
                <ul class="rlist">
                    <c:forEach items="${recommendUsers}" var="user">
                    <li class="recommendLi">
                        <div class="usericon recommendicon">
                        <c:choose>
                            <c:when test='${user.avatar != "" && user.avatar != null}'>
                                <img src="${user.avatar}" alt="">
                            </c:when>
                            <c:otherwise>
                                <img src="images/avatar.jpg" alt="">
                            </c:otherwise>
                        </c:choose>
                        </div><div class="recommendName"><a href="<%=context%>/userlist?u=${user.id}">${user.name}</a></div>
                    </li>
                    </c:forEach>

                </ul>
            </div>
            <div class="rightItem" id="articalRecommendBox">
                <div class="title">推荐博文</div>
                <ul class="rlist">
                    <c:forEach items="${recommendBlogs}" var="blog">
                        <li><span class="listTitle"><a href="<%=context%>/content?b=${blog.id}">${blog.title}</a></span></li>

                    </c:forEach>
                </ul>
            </div>

        </div>
    </div>
</div>
<c:import url="bottom.jsp"/>

</body>
</html>
